Page({

  /**
   * 页面的初始数据
   */
  data: {
    is_show_cer: false,
    funLists: [
      {
        id: "mail",
        routeUrl: "/pages/mail/mail",
        title: "扫码寄件",
        description: "更便捷、先人一步下订单",
        img: "/images/index/mail_3x.png",
        isTag: false,
        tagImg: "",
      },
      {
        id: "needMail",
        // routeUrl: "/pages/needMail/needMail",
        routeUrl: "/pages/mail/mail",
        title: "我要寄件",
        description: "一键寄出，省时省力",
        img: "/images/index/needMail.png",
        isTag: false,
        tagImg: "",
      },
      {
        id: "contact",
        routeUrl: "/pages/contact/contact?source=index",
        title: "通讯录管理",
        description: "快速查找我的寄件信息",
        img: "/images/index/contact_3x.png",
        isTag: false,
        tagImg: "",
      },
      {
        id: "verified",
        routeUrl: "/pages/verified/verified",
        title: "实名认证",
        description: "认证个人信息、安全靠谱",
        img: "/images/index/verified_3x.png",
        isTag: false,
        tagImg: "",
      },
      {
        id: "waybill",
        routeUrl: "/pages/waybill/waybill",
        title: "托运单查询",
        description: "快速查看订单节时省力",
        img: "/images/index/search_3x.png",
        isTag: false,
        tagImg: "",
      }
      // {
      //   id: "bindphone",
      //   routeUrl: "/pages/bindphone/bindphone",
      //   title: "绑定手机号码",
      //   description: "绑定手机，消息及时接收",
      //   img: "/images/index/bindphone_2x.png",
      //   isTag: false,
      //   tagImg: "",
      // },
     
    ]
  },
  toOtherPages: function(e){
    if(e.currentTarget.dataset.id == 'mail'){
      return wx.scanCode({
        success(res) {
          console.log(res,'::::::::::res')
          wx.navigateTo({
            url: '/' + res.path,
          })
        }
      })
    }
    wx.navigateTo({
      url: e.currentTarget.dataset.routeurl,
    })
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log('index_options', options);
    this.is_cert();
  },

  /**
   * 定时函数判断实名认证
   */
  is_cert: function(){
    let that = this;
    let cert_time = setInterval(function () {
      if (wx.getStorageSync('login')  &&  !wx.getStorageSync('is_certification')) {    //如果没有实名认证的话，则展示出实名认证的入口图片
        that.setData({
          is_show_cer: true
        });
      }
      if (that.data.is_show_cer) {
        clearInterval(cert_time);       //如果已经为真了，就没必要再定时了
      }
    }, 1000);

  },


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  }
})